package org.snail.employee.service;

import com.dingtalk.open.client.api.model.corp.CorpUserDetail;
import com.github.pagehelper.PageInfo;
import org.snail.employee.bean.EmpCondition;
import org.snail.employee.bean.EmployeesDO;
import org.snail.employee.bean.EmployeesSaveEmpList;
import org.snail.exception.BaseException;
import org.snail.exception.EmpException;
import org.springframework.web.multipart.commons.CommonsMultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.Map;

public interface EmployessService {
    /**
     * 保存员工信息
     * @param employeesSaveEmpList
     */
    public void saveEmpList_v2(EmployeesSaveEmpList employeesSaveEmpList) throws InvocationTargetException, IllegalAccessException, EmpException;

    /**
     * 获取所有员工信息
     * @return
     */
    public Map<String,PageInfo> findAllEmp(EmpCondition empCondition);


    /**
     * 通过id查找员工
     * @param empCondition
     * @return
     */
    public EmployeesDO findEmpById(EmpCondition empCondition) throws EmpException;

    /**
     * 删除员工
     * @param id
     */
    public void deleteEmp(Integer id);

    /**
     * 预览
     * @param file
     * @param empType
     * @param request
     */
    public List<EmployeesDO> preview_v2(CommonsMultipartFile file, String empType, HttpServletRequest request) throws BaseException, InvocationTargetException, IllegalAccessException, ClassNotFoundException;

    /**
     * 把人员信息推送到缓存中
     * @param deptUserList
     * @return
     */
    public boolean pushEmpToRedis(List<CorpUserDetail> deptUserList);

    /**
     * 通过Dingid查找员工
     * @param empCondition
     * @return
     */
    public EmployeesDO findEmpByDingId(EmpCondition empCondition) throws EmpException ;

    /**
     * 通过Dingid新增人员
     * @param employeesDO4Ding
     * @return
     */
    public void InsertEmpFromDingding(EmployeesDO employeesDO4Ding);
}